<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
{insert name="module_cssjs" css="core.css" js="jquery.min.js"}
</head>
{literal}
<script type="text/javascript">
$(document).ready(function() {

$('[name="add-form"]').submit(function() {
	var name = $('input[name="name"]').val();
	if(!name) {
		alert('请输入分类名称'); return false;
	}
	var params = $('[name="add-form"]').serialize();
	$.post('/yunying/page/category/add.json', params, function(dt) {
		if(dt.status) {
			alert(dt.message);
		} else {
			window.location.href = '/yunying/page/category/';
		}
	}, 'json')
	return false;
});

$('[name="edit-form"]').submit(function() {
	var cid = $('input[name="cid"]').val();
	if(!cid) {
		alert('未知分类'); return false;
	}
	var name = $('input[name="name"]').val();
	if(!name) {
		alert('请输入节点名称'); return false;
	}
	var params = $('[name="edit-form"]').serialize();
	$.post('/yunying/page/category/edit.json', params, function(dt) {
		if(dt.status) {
			alert(dt.message);
		} else {
			window.location.href = '/yunying/page/category/';
		}
	}, 'json')
	return false;
});
})
</script>
{/literal}
<body>
<h3 class="label">
	{if $act == 'edit'}
	<strong class="on"><span>编辑分类</span></strong>
	<span class="refresh"><a href="javascript:history.go(-1);">返回</a></span>
	{else}
	<strong><span><a href="/yunying/page/category/">所有分类</a></span></strong>
	<strong class="on"><span>添加分类</span></strong>
	{/if}
	<span class="refresh"><a href="">刷新</a></span>
</h3>
<div class="table">
	<form {if $act == 'edit'}name="edit-form"{else}name="add-form"{/if} action="post">
	{if $act == 'edit'}<input name="cid" type="hidden" value="{$info.cid}" />{/if}
	<table class="TB-form">
		<tr>
			<td width="80">分类名称：</td>
			<td><input class="input" name="name" value="{$info.name}" /></td>
		</tr>
	</table>
	<div class="btn-box">
		<span class="btn-indent"><input class="btn" type="submit" value="保&nbsp;&nbsp;存" /></span>
		<span class="btn-indent"><input class="btn" type="reset" value="重&nbsp;&nbsp;置" /></span>
	</div>
	</form>
</div>

</body>
</html>